home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
USA Bestseller
/
USA BESTSELLER Vol 1-95 (Hepp-Computer)(1995).iso
/
e204
/
ucalc.doc
< prev
next >
Wrap
Text File
|
1994-08-16
|
50KB
|
1,264 lines
=======================================================================
ULTIMATE CALCULATOR 2.4
Copyright (C) 1992-1994 by Daniel Corbier
All Rights Reserved.
=======================================================================
CONTENTS
--------
1. Introduction
2. UCALC Features
3. Getting Started
3.1 Installation
3.2 Running UCALC
4. DOS Command Line
5. UCALC Prompt
6. Table of Symbols
7. Order of Precedence
8. Flexible Syntax
9. GRAPHING
9.1 Setting the screen coordinate system (WINDOW)
9.2 Turning colors off (MONO)
9.3 Automatic coloring (AUTOCLR)
9.4 Graphing precision (PREC)
9.5 Graphic card selection
9.6 Plotting
9.6.1 Cartesian
9.6.2 Parametric
9.6.3 Polar
9.6.4 Plotting data from another file
9.6.5 Line segment
9.6.6 Rectangle
9.6.7 Filling an area
9.7 Moving the crosshair
9.8 Printing a graphic screen
10. Summation
11. Numerical Integration
12. Solving Equations
13. LOAD command
14. WRITE command
15. SHELL command
16. Numerical Notations
17. Implicit Multiplications
18. Assigning Variables
19. Assigning Functions
20. UCALC.DEF
21. Technical Notes
22. Registration
23. Shareware Author & User Case Study
24. My Address
25. Distribution
26. Acknowledgments
1. Introduction
============
UCALC is a graphic scientific calculator which can evaluate
expressions, solve equations, plot equations, perform numerical
integrations, and do summations. It supports many built-in functions,
operators, numerical notations, and modes. It also allows for
user-defined functions and variables. Expressions such as the
following are accepted:
63 - 5 + 4.821
(5.9-abs(2.8/5-3))^2 + sin( 3-(pi+3/4)*myfunction(x,y) )
sum(x^2+x-2,1..500)
solve(3*x^2+2*x-5=27)
integ(x^2*sin(x),1..5)
#b101010 and (#b10101 or #h1CC) * 2^5
15 * sin(pi/4)+abs(10-(5+log(20))^2+9)-#b101110111
plot sin(x)*x^2/10
plot x=sin(t)-sin(2t), y=cos(t)-cos(2t)
plot r=t/pi, 0..10pi
2. UCALC Features
==============
- Math expression evaluator
- Fast equation plotting
- Equations can be solved
- Supports user defined variables
- Supports user defined functions which allow many arguments
- Radian, degree, and gradient modes for trig functions
- Decimal, hexadecimal, binary and octal notations
- Summations
- Numerical integration
- Support for up to 16 supper-imposed multi-color user graphs
- Cartesian (rectangular), Polar, and Parametric user graphs
- High precision: 18 significant digits. +/-3.4E-4932 to +/-1.2E+4932
- Online help with F1
- Flexible syntax
- Line editor with expression recall
- Expressions can also be entered at the DOS command line
- Arithmetic operators
- Bitwise operators
- Relational operators
- Trig functions
- Hyperbolic functions
- Common functions such as factorial, absolute value, log, etc...
- Implicit multiplication
- Commands to list all user variables & functions
- DOS redirection
- Adjustable FIX notation
- Adjustable number of digits
- LOAD & WRITE commands to retrieve or save a session
- PRINT command to send text output to the printer
- SHELL command to temporarily go to DOS
- CGA, EGA, Hercules, and VGA modes for graphing
- LINE, FILL, and RECTangle commands
- Data from another file can be plotted
- Smart graphic crosshair
- Adjustable screen coordinate system
- Adjustable precision for graphs
3. Getting Started
===============
3.1 Installation
------------
Copy UCALC.EXE to a directory defined in the PATH statement of your
AUTOEXEC.BAT file (such as your DOS or UTILS directory). If you do
most of your calculations at the command line, then you can put it in a
RAM drive for faster loading. UCALC can also be run from the current
directory.
UCALC is ready to run as-is. But it can be customized by creating a
file named UCALC.DEF, and entering certain settings. This file can be
placed in the same directory as UCALC.EXE. See UCALC.DE as an example.
That file can be modified and renamed UCALC.DEF.
3.2 Running UCALC
-------------
There are two ways of running the Ultimate Calculator. The first way
is to enter your expression at the DOS command line as follows:
UCALC 5+4*8/2 [enter]
UCALC also provides a line editor for performing multiple calculations.
This environment allows you to assign values to variables, and define
functions as you go along. To run UCALC in that mode, simply invoke
UCALC at the DOS command line without any expression as follows:
UCALC [enter]
When you are in this mode, you can press [F1] any time for help, and
[Esc] to quit the program. See EXAMPLES.DOC to get more ideas on how
to use UCALC. For a graphic demo, enter UCALC < PLOTDEMO from the
DOS prompt.
4. DOS Command Line
================
At the DOS command line, you can type UCALC followed by one of these
options:
/? Help
/NODEF Does not load UCALC.DEF
If an expression is present at the command line, it is evaluated, and
control returns to DOS. Otherwise, you are left at the 'ucalc> '
prompt, where you may enter several expressions and quit with [Esc].
If a symbol in your expression is in conflict with DOS, then enclose
the expression in quotes.
Examples:
---------
UCALC /NODEF
UCALC "5^4 | 5*8"
See EXAMPLES.DOC for a sample session.
5. UCALC Prompt
============
At the 'ucalc> ' prompt, expressions to be evaluated can be entered,
functions and variables can be defined, and the following commands, and
function keys can be entered:
[F1] Help (same as HELP or ?)
[F2] Lists variables (same as LIST)
[F3] Displays UCALC.DEF (same as LIST DEF)
[F4] DOS shell (same as SHELL)
[F5] Lists user functions (same as LISTF)
[Esc] Quit (same as QUIT, see also EXIT)
AUTOCLR [nn] Sets the number of colors used in graphing.
CLOSE Closes the file opened with the WRITE command.
CLS Clears the screen.
DIG nn Changes the total number of digits displayed.
EXIT Exits to DOS without asking if you're sure.
FIX nn Changes number of decimal digits displayed.
HELP Gives online help (same as F1 or ?).
INTEG(fx,a..b [,n]) Numerical integration.
LIST Lists user defined variables (same as F2).
LISTF Lists user defined functions (same as F5).
LIST DEF Displays the contents of UCALC.DEF (F3).
LOAD"filename" Loads a file.
MODE {DEG|RAD|GRA} Changes mode to degree, radian, or gradient.
MODE {HGC|CGA|EGA|VGA} Sets the graphic mode.
MODE HBO Toggles the hex, binary, octal answer display.
MONO Turns graphic mode colors off.
PLOT [equation] Plots user equations.
PREC nn Changes the precision used in graphing.
PRINT [ON|OFF] Prints the current session as you work.
PROMPT"yourprompt" Changes or removes the "ucalc> " prompt.
PROMPTA"yourprompt" Changes or removes the "Answer: " prompt.
QUIT Exits to DOS, and asks if you're sure.
SHELL Shells to DOS (same as F4).
SHELL"command" Executes a DOS command.
SOLVE(fx [=fx] [,a..b]) Solves an equation.
SUM(fx,a..b [,dx]) Summation of function fx ranging from a to b.
SUMTABLE(fx,a..b [,dx]) Summation which displays intermediate results.
WINDOW(x1,x2,y1,y2) Changes the screen coordinate system.
WRITE"filename" Records your session to a file.
The variable 'last' contains the value of the previous computation.
Variable 'x' is the parameter which should be used with SUM, SUMTABLE,
and SOLVE. Selections which appear inside brackets [] are optional.
At the 'ucalc> ' prompt, the up (or down) arrow keys can be used to
recall previous expressions. Several characters may be keyed in before
pressing the up arrow in order to recall an expression starting with
those characters.
6. Table of Symbols
================
Symbol Equivalent Description Example
------ ---------- ----------- -------
( ) Prioritizes an expression 5*(1+1) = 10
! Factorial 5! = 120
^ ** Raised to the power of 4 ^ 5 = 1024
* Multiply by 3 * 6 = 18
/ Divide by 9 / 2 = 4.5
% MOD Modulo 7 % 4 = 3
+ Add 1 + 1 = 2
- Subtract 9 - 5 = 4
> Greater than 9 > 2 = 1
< Less than 7 < 4 = 0
= == Equal test 5 = 4 = 0
>= => Greater or equal 3 >= 3 = 1
<= =< Less or equal $3E <= 9 = 0
<> Not Equal #b10101 <> 20 = 1
NOT Bitwise 'not' not(15) = -16
AND & Bitwise 'and' #b101 and #h1E = 4
OR | Bitwise 'or' 13 or 6 = 15
XOR Bitwise 'exclusive or' 9 xor 3 = 10
EQV Bitwise 'equivalence' 6 eqv 9 = -16
IMP Bitwise 'implication' 1 imp 5 = -1
SIN Sine sin(pi) = 0
COS Cosine cos(pi) = -1
TAN Tangent tan(pi) = 0
ASIN Arcsine asin(1) = 1.570
ACOS Arccosine acos(-1) = 3.141
ATAN ATN Arctangent atan(0) = 0
SINH Hyperbolic sine sinh(3) = 10.01
COSH Hyperbolic cosine cosh(2) = 3.762
TANH Hyperbolic tangent tanh(1) = 0.761
COTH Hyperbolic cotangent coth(1) = 1.318
SECH Hyperbolic secant sech(0) = 1
CSCH Hyperbolic cosecant csch(1) = 0.850
ASINH Hyperbolic arcsine asinh(2) = 1.443
ACOSH Hyperbolic arccosine acosh(9) = 2.887
ATANH Hyperbolic arctangent atanh(.5) = 1.098
ACOTH Hyperbolic arccotangent acoth(7) = 0.143
ASECH Hyperbolic arcsecant asech(.3) = 1.873
ACSCH Hyperbolic arccosecant acsch(2) = 0.481
ABS Absolute value abs(-8) = 8
EXP e to the power of exp(3) = 20.08
RND Random number rnd(1) = .9686
INT Truncate to an integer int(6.8) = 6
CEIL Round upward ceil(6.8) = 7
EXP2 2 to the xth power exp2(3) = 8
EXP10 10 to the xth power exp10(3) = 1000
FACT Factorial fact(5) = 120
LOG2 Log base 2 log2(8) = 3
LOG10 Log base 10 log10(100) = 2
LOG LN Natural log log(16) = 2.77
SGN SIGN Sign of expression sgn(-9) = -1
SQR SQRT Square root sqr(64) = 8
7. Order of Precedence
===================
Here is the precedence list from highest to lowest priority:
Anything inside parenthesis is performed first ( )
Factorial !
Exponentiation ^
Multiplication, division *, /
Modulo MOD
Addition, subtraction +, -
Relational operators <, >, >=, <=, =, <>
AND
OR, XOR (exclusive or)
EQV (equivalence)
IMP (implication)
When consecutive operators have the same priority, UCALC evaluates from
left to right. This means that an expression such as "a-b-c" is
evaluated as "(a-b)-c".
8. Flexible Syntax
===============
UCALC is designed to work in a simple and familiar way, and
accommodates itself to several styles, so that users may start being
productive the very first time the program is executed. Refer to '6.
Table of Symbols' for the alternative notations of several operators
and functions. The entries below which are grouped together are
equivalent:
ucalc> LOAD"myfile" ; The interchangeability of the quote and
ucalc> LOAD myfile ; parenthesis, or lack of either is also possible
ucalc> LOAD(myfile) ; for MODE, FIX, DIG, AUTOCLR, and PREC.
ucalc> SOLVE(x^2=100) ; The outer parenthesis can also be omitted in
ucalc> SOLVE x^2=100 ; WINDOW, INTEG, SUM, and SUMTABLE.
ucalc> SUMTABLE(x, 1..10) ; Any entry which uses '..' can
ucalc> SUMTABLE(x, 1 to 10) ; also use ' TO ' instead.
ucalc> SUMTABLE x, 1 to 10
ucalc> PLOT y=x^2 ; 'y=' can be omitted for these types
ucalc> PLOT x^2 ; of graphic equations.
ucalc> PLOT x=t, y=t^2, -5..5 ; 'x=' and 'y=' can be omitted
ucalc> PLOT t, t^2, -5..5
ucalc> PLOT t, t^2, -5 to 5
9. GRAPHING
========
To see a demonstration of some of UCALC's graphing capabilities, enter
the following at the DOS prompt:
UCALC < PLOTDEMO
Make sure that the PLOTDEMO, GRAPH1.DAT, and GRAPH2.DAT files are in
the current directory.
9.1 Setting the screen coordinate system (WINDOW)
---------------------------------------------
Syntax: WINDOW(x1,x2,y1,y2)
This modifies the graphic screen coordinate system. (x1,y1) represents
the lower left hand corner of the screen, and (x2,y2) represents the
upper right hand corner. The default is WINDOW(-10,10,-7.5,7.5), which
means that the origin (0,0) is at the center of the screen, with point
(-10,-7.5) at the bottom left of the screen and (10,7.5) at the top
right of the screen.
Examples:
---------
ucalc> WINDOW(0,10,0,7.5)
This sets the origin at the bottom left of the screen.
ucalc> WINDOW(-1,1,-1,1)
The origin is at the center, and x goes from -1 to 1, and so does y.
9.2 Turning colors off (MONO)
-------------------------
Syntax: MONO
This turns all colors off in the graphic mode. Those who do not have a
color monitor may want to include this command in UCALC.DEF. This
command may also be useful for a better printout, or when filling the
area between graphs (with FILL).
9.3 Automatic coloring (AUTOCLR)
----------------------------
Syntax: AUTOCLR [nn]
This command causes each consecutive graph to be displayed in a
different color. The optional 'nn' parameter indicates how many
different colors can be used. The default is 15. If some graphs turn
out to be invisible, then a smaller number should be chosen for 'nn'.
The CGA mode does not use color.
Examples:
---------
ucalc> AUTOCLR ; Allows 15 different colors (default)
ucalc> AUTOCLR 3 ; Tells UCALC to use only 3 different colors
9.4 Graphing precision (PREC)
-------------------------
Syntax: PREC nn
This changes the precision used in graphing. The higher 'nn' is, the
higher the precision will be. More precision naturally means slower
plotting. The default precision is 10, and should be fine for many
graphs. If stray lines appear in an unbounded graph, or if the graph
appears jagged, or if the curve doesn't quite reach the starting or
ending points (such as in polar graphs) then raising the precision
should solve the problem.
Example:
--------
ucalc> PREC 100
9.5 Graphic card selection
----------------------
Syntax: MODE {CGA | EGA | HGC | VGA}
This changes the graphic mode that is used for plotting. When UCALC
loads up, it automatically determines which type of graphic card is
being used. If it cannot do so properly, then put a MODE statement in
UCALC.DEF, with the proper selection.
Example:
--------
ucalc> MODE EGA ; Sets the monitor to EGA mode
9.6 Plotting
--------
Syntax: PLOT equation
or PLOT
This plots user equations. If an equation is entered on the same line
as the PLOT command, then it will be plotted. If PLOT is entered alone
at the 'ucalc> ' command line, then the user will be asked to enter
several equations. Press [return] twice when finished entering
equations. Up to 16 user equations can be displayed simultaneously.
NOTE: Unlike expressions that are evaluated at the 'ucalc> ' prompt,
equations that are going to be plotted aren't checked for
certain errors. Division by 0, square root of negative numbers,
etc... do not stop the graph from being plotted.
Examples:
---------
ucalc> PLOT sin(x)
ucalc> PLOT r=t/5
ucalc> PLOT 2x+7
ucalc> PLOT ; PLOT by itself prompts for multiple equations
Equation 1: x^2 ; Plots a parabola
Equation 2: fill(1,3) ; Fills an area bounded by the equation above
Equation 3: line(2,3,-1,5); Line segment from (2,3) to (-1,5)
Equation 4: r=t^2/pi ; Polar equation
Equation 5: cos(x), sin(x); Parametric equation
Equation 6:
After hitting [enter] on the blank line, it will plot the 5 entries
above. Any combination of equations can be entered. The plotting of
an equation can be aborted at any time, by hitting any key.
The following entries can be plotted:
9.6.1 Cartesian
---------
Syntax: y = f(x) (or simply f(x))
This plots a curve in the rectangular coordinate system (Cartesian).
As a shortcut, the 'y=' can be omitted. For instance, 'y=x^2' can
simply be entered as 'x^2'. The variable parameter is 'x'.
Examples:
---------
PLOT y=tan(x)
PLOT sin(x)-3
9.6.2 Parametric
----------
Syntax: x = f(t), y = g(t) [,a..b] (or simply f(t), g(t) [,a..b])
Certain types of curves in the x-y plane cannot be expressed in the
form 'y=f(x)'. Parametric equations are more flexible, and can even be
used as a superset of equations in the 'y=f(x)' form. 'y=f(x)' can be
expressed as 'x=t, y=f(t)', with the advantage of being able to set an
interval. Equations in the form 'x=f(y)' can also be entered as a
parametric equation, in the form 'x=f(t), y=t' with an optional
interval. If the optional interval is omitted, UCALC uses 0..2pi.
Examples:
---------
ucalc> PLOT x= cos(t), y= t-2
ucalc> PLOT cos(t), t-2 ; This is the same as above
ucalc> PLOT cos(t)+2, sin(t)/pi, 0..3pi
ucalc> PLOT t, 2 cos(t), -5..5 ; Same as y=2 cos(x) but from -5 to 5
NOTE: Remember that the variable parameter is 't' (and not 'x').
9.6.3 Polar
-----
Syntax: r = f(t) [,a..b]
'r=' is what makes UCALC recognize that it's a polar equation. If the
optional a..b range is not entered, then the default 0..2pi will be
used. The variable parameter for polar equations is 't'.
Examples:
---------
ucalc> PLOT r=t/pi, 0..10pi
ucalc> PLOT r=sin(t)
ucalc> PLOT r=t*sin(t)
9.6.4 Plotting data from another file
-------------------------------
Syntax: "mygraph.dat"
Graphs from a text file can be plotted by entering the name of the file
inside quotes. The file must consist of a list of x and y coordinates
which are separated by spaces, or a comma. The file may look something
like this:
-10 .5440211108893698
-9 -.4121184852417566
-8 -.9893582466233818
-7 -.6569865987187891
etc...
Example:
--------
ucalc> PLOT"mygraph.dat"
9.6.5 Line segment
------------
Syntax: LINE(x1,y1,x2,y2)
This produces a line segment with endpoints (x1,y1) and (x2,y2).
Example:
--------
ucalc> PLOT line(3,2,5,7)
9.6.6 Rectangle
---------
Syntax: RECT(x1,y1,x2,y2)
This produces a rectangle which has opposing corners (x1,y1) and
(x2,y2).
Example:
--------
ucalc> PLOT rect(0,0,5,6)
9.6.7 Filling an area
---------------
Syntax: FILL(x,y)
This fills a bounded area on the screen in which (x,y) is located. In
monochrome mode, it fills the area around (x,y) enclosed within any
other curve, or the edge of the screen. If the graphs are in multiple
colors, then the FILL statement only uses the color of the preceding
graph as a boundary. Fill is more useful when used with multiple
graphs. See section '9.6 Plotting' for an example.
9.7 Moving the crosshair
--------------------
After the graphs have been plotted, a crosshair (graphic cursor) is
placed at the upper left hand corner of the screen. It can be moved
with the arrow keys in order to pinpoint coordinates on the screen.
The Home, End, PgUp, and PgDn keys can also be used, for diagonal
movement. To move the crosshair slowly, press the key and release it
quickly. To move it faster, hold the key down as it accelerates.
9.8 Printing a graphic screen
-------------------------
In order to be able to send graphs to the printer, run GRAPHICS.COM
(which comes with DOS) before loading UCALC. Then, when a graph is on
the screen, press the 'Print Screen' key to send it out to the printer.
For better results on printers which do not support color, issue the
MONO command at the 'ucalc> ' prompt before plotting. See the DOS
manual for more details on GRAPHICS.COM. This version of UCALC has no
built-in mechanism for printing.
10. Summation
=========
Syntax: SUM(fx,a..b [,dx])
b
____
\ f(x) is written as SUM(f(x),a..b), where f(x) is your
/___ function, and a..b is the range.
x= a The summation cannot be part of another expression.
The optional dx parameter can be used to indicate an increment other
than the default 1.
Examples:
---------
ucalc> sum(x^2+2*x+14,5..1000)
Answer: 334848394
ucalc> sum(x^3-2,1..15,.1)
Answer: 127971.6
SUMTABLE is the same as SUM, except that intermediate values are
printed as the sum is being added.
ucalc> sumtable(x^2/fact(x),1..3)
Count Value Cumulative
1 1 1
2 2 3
3 1.5 4.5
Answer: 4.5
A long list can be aborted with the [Esc] key.
11. Numerical Integration
=====================
Syntax: INTEG(fx,a..b [,n])
This approximates the value for the definite integral of fx, using
Simpson's rule. This rule requires that n be an even number. UCALC
takes care of that by automatically transforming n to the next
highest even number (n = n + n mod 2). If no value for n is given,
then 100 is used as the default number of subdivisions. This command
works properly only when fx is a continuous function.
Examples:
---------
ucalc> integ(x*sin(x),0..pi)
Answer: 3.14159267059288459
ucalc> integ(1-x^2,0..1,8)
Answer: .666666666666666667
12. Solving Equations
=================
Syntax: SOLVE(fx [=fx] [,a..b])
This solves an equation for the value of 'x'. The statements in
brackets are optional. If the expression on the right of the = sign is
0, then you can simply do: SOLVE(expression). For instance,
SOLVE(3*x+2=0) can be written as SOLVE(3*x+2). If the equation happens
to have several solutions, you can indicate the domain (a..b) of the
particular solution you are interested in.
The algorithm used in this program for solving equations is the
Bisection Method, which is a special case of the Intermediate Value
Theorem. A solution can be found for continuous functions in the range
a < x < b, where f(a) < 0 < f(b). If a..b is not defined, then the
default range is from -1E6 to 1E6. If a real solution does exist, but
cannot be found with the default range, then try narrowing the range as
much as possible.
Examples:
---------
ucalc> solve( exp(x+x^2)-sqr(x+5) = 127 )
Answer: 1.76151609179570087
ucalc> solve( cos(x), pi/2..pi )
Answer: 1.57079632679489662
ucalc> solve( x^3+2*x+5 = 10+7 )
Answer: 2
ucalc> solve( 2*x^2-3 )
Answer: 1.22474487139158905
13. LOAD command
============
Syntax: LOAD"filename"
This command loads up the contents of a file into the UCALC workspace.
The file may contain any UCALC command. A file saved with the WRITE
command however, cannot be loaded directly if it contains 'ucalc> '
prompts.
Examples:
---------
ucalc> load"convert.def"
ucalc> load"finance.def"
ucalc> load"formula.asc"
14. WRITE command
=============
Syntax: WRITE"filename"
This command records your UCALC session to a file name that you
specify. Everything that is displayed on the screen will go to that
file verbatim, until you issue the CLOSE command, or exit to DOS. If
the file already exists, the WRITE command will append to it.
Example:
--------
ucalc> write"ucalc.log"
15. SHELL command
=============
Syntax: SHELL
This allows you to drop to DOS temporarily. To resume your session,
type EXIT at the DOS prompt. [F4] does the same thing as the SHELL
command. You may also pass a command for DOS to execute.
Examples:
---------
ucalc> shell"dir" ; This executes the DIR command.
ucalc> shell ; This drops you to DOS until you type EXIT.
16. Numerical Notations
===================
The default numerical type is DECIMAL. Binary, octal, and hexadecimal
number types are also supported. The latter types must be preceded by
the # (number sign) symbol, and one of the letters "h", "b", or "o",
for hexadecimal, binary, or octal in that respective order. The $ sign
for hexadecimal notation can be used as a shortcut. See examples.
In order to see all your answers in hex, binary, and octal, issue the
command: mode HBO
Exponential notation is also supported. These are numbers followed by
the letter E, and an exponent number. For instance: 3.4E+5 translates
to 3.4*10^5, and 3.4E-5 translates to 3.4*10^(-5).
Examples:
---------
#b110101110, #o656, #h1AE, $1AE, 430, 4.3E2
are all the same number.
#b10101^2 * 5/$1EF + sin(5.8+2)*cos(#o302)-7E6 is a valid expression.
17. Implicit Multiplications
========================
When writing math expressions, it is common to omit the times symbol
(*), when multiplication is implied. For instance, one may write
'2x+5', which is the same as '2*x+5'. The following are examples of
implied multiplications supported by UCALC.
Expression Equivalent
---------- ----------
x y x*y
3pi+10 3*pi+10
5(4+8) 5*(4+8)
(5+5)(3+9) (5+5)*(3+9)
(3+2)8 (3+2)*8
NOTE: Implicit multiplication has the same priority as regular
multiplication. For instance '1/2q' is the equivalent of
'1/2*q' not '1/(2q)'. (This is subject to change in a future
version).
18. Assigning Variables
===================
Variables can be used to store values, which can later become part of
an expression. They are composed of letters of the alphabet, and may
contain numerical digits, as long as a numerical digit is not the first
character.
Examples:
---------
mynumber = 12345
mass = 15
speed = 23+10.5
m1 = 10*pi^2
c2 = sqrt(37) + 5
19. Assigning Functions
===================
Once defined, a user function can be used anywhere a built-in function
can be used. The naming convention of functions is similar to that of
variables. Argument names used in defining functions are temporary,
and do not affect user variables with the same name. The name of the
function itself, however, should be unique. User functions can accept
many arguments.
Examples:
---------
cube(x) = x^3
area(r,h) = pi*r*sqr(r^2+h^2) ; area of right circular cone
logx(base,num) = ln(num) / ln(base)
abc() = 5 + sin(b)
20. UCALC.DEF
=========
Commonly used constants & functions, such as e, and logx(x,y) and any
others that are used regularly, can be defined in UCALC.DEF. This file
can be created or modified with any ASCII text editor. The semicolon
(;) can be used as a remark. Anything following it will not be
interpreted as part of the expression.
Every time UCALC is run, it looks for UCALC.DEF in the current
directory first, and then in the directory which UCALC.EXE was loaded
from. If the file is found, its functions and variables are loaded.
The /NODEF option at the command line is equivalent to not having a
UCALC.DEF file.
Here is an example of what UCALC.DEF may look like:
fix 5
mode ega
window(-10,10,-7,7)
load"convert.def"
prompt"" ; Removes the default 'ucalc> ' prompt
prompta"A:" ; Replaces the default 'Answer: ' prompt with 'A:'
e = 2.718281828459045 ; Natural log constant
gravity = 9.8 ; Acceleration due to gravity
na = 6.0221367E+23 ; Avogadro's number 1/mol
logx(base,num) = log(num) / log(base)
A total maximum of 300 variables, and 200 user functions can be
defined.
21. Technical Notes
===============
o DOS IO: A file with calculations to be performed may be created
ahead of time with your favorite text editor, and passed at the
command line in the following format:
UCALC < MYFILE.DAT > RESULT.DAT
An expression at the command line can also be redirected:
UCALC sumtable(2*x+5,1..1000) > RESULT.DAT
o End-of-file: When doing redirection from the DOS command line, make
sure that the input file ends with an end-of-file marker (^Z, or
ASCII 26). Many text editors take care of this automatically, but a
few don't. An input file may alternatively end with a ^C (ASCII 3)
or the EXIT command. Be sure to add several blank lines at the end
of the input file. An input file with no ^C, ^Z or EXIT, and no
blank lines at the end may cause UCALC to freeze.
o Ugly Numbers: Occasionally, numbers are not displayed as one might
expect. For instance you might get 8.23423423982432343E-18 instead
of 0, or .499999999999999999 instead of .5, which is actually pretty
close to the answer. This may happen as a result of lengthy
operations, or certain types of functions. One solution is to reduce
the number of decimal digits that are displayed with the FIX command.
o Command Line Conflicts: Certain symbols used by UCALC may also be
interpreted by DOS or other command shells. If there is a conflict,
then enclose the command line expression in quotes, such as the
following:
UCALC "(5^4 | 18) < 10"
o HBO mode: When this mode is on, it will display the hex, binary, and
octal notations, only for values between -32766 and 65535. Numbers
beyond that range are displayed only in decimal form. Negative
numbers are represented in "two's complement" form. Only the integer
part of a number is displayed in hex, bin, and oct. Entering 'MODE
HBO' turns the HBO mode on. Typing the same command again turns it
back off.
o Relational operators return a 1 for true expressions, and 0 for false
ones. For instance, 5 > 3 = 1, and 5 < 3 = 0.
o Compound Functions: Functions with multiple entries may be defined
by using relational operators. For instance:
/ 2+x^2, x > 0
f(x) = | 3, x = 0
\ x*2+8, x < 0
can be written as:
f(x) = (2+x^2)*(x > 0) + (3)*(x = 0) + (x*2+8)*(x < 0)
o Equal Sign: The single equal sign, =, can be used both for assigning
functions & variables, and as a relational operator. If there is a
conflict in the logic of an expression such that it can be taken
either way, then use the double equal sign, ==, when a relational
operator is intended. An assignment is assumed only when the
expression left of the left-most equal sign is a valid function or
variable name.
o Limited Function Space: There is a limit of instructions (such as +,
-, *, etc...) which can be used for defining functions. Every time a
function is defined or redefined, part of the instruction list is
filled, and cannot be reclaimed during a UCALC session. An error
message is given when too many functions have been defined.
o Each expression can use a maximum of 33 instructions. If an
expression is too long, UCALC returns an error message. Expressions
can be broken down into several shorter ones.
o Variable names: Variable and function names may be up to 1024
characters long, which should be more than enough for most purposes.
These names may consist of any ASCII character other than those used
as operators. The first character cannot be a numerical digit. A
variable should not have the same name as a function, due to support
for implicit multiplication.
o UCALC is not case sensitive. Upper case letters are treated just the
same as lower case letters. For instance, pi, PI, and Pi are all
treated the same.
o Text Buffer: The last 100 lines can be recalled using the up (or
down) arrow keys.
o Rounding: The rounding method in UCALC is called banker's rounding.
With this method, numbers are rounded towards the closest even
number. For instance, both 11.50 and 12.50 are rounded to 12, and
both 13.50 and 14.50 are rounded to 14, when FIX is set to 0. Only
the displayed number is rounded, but the actual calculations are
performed in high precision.
o Random Numbers: The RND function produces a random number between 0
and 1. RND(1) returns a new random number each time it is used.
RND(0) returns the previously used random number. If x is negative,
then RND(x) returns a predictable number. For instance, RND(-5) will
produce the same number each time. To get a random number between 0
& x, simply use RND(1)*x. For instance, RND(1)*50 will return a
random number between 0 & 50.
o When UCALC is loaded, it automatically detects which graphic card to
use. To override UCALC's selection, the MODE command (with CGA, EGA,
VGA, or HGC) can be placed in UCALC.DEF.
o The graphic screen is optimized for the VGA mode. With lower
resolution, the crosshair will give a less accurate reading of its
location on the screen. WINDOW(-10,10,-7,7) is a better setting for
the EGA mode.
22. Registration
============
UCALC is not "free", neither is it "public domain". It is a
copyrighted program distributed through the shareware channel. This
allows users to try the program first to see if it suits their needs.
If you decide to continue using it, then please remember to pay the
author the requested registration fee. UCALC costs only $25 for
individual use, or less per machine for a site license. Some users may
even qualify for a free registration.
As in the first version, I am now offering several bonus features
available only to those who register, as an incentive. In the
registered version:
- Colors in the text screen and graphic mode can be changed.
- The axis can be turned off or on or have a different color.
- A grid can be added in the graphic mode.
- Text can be added in the graphic screen.
- Graphs can optionally be plotted by unconnected dots.
* And of course, it has no registration reminder text.
More importantly, your registration will help pay for past debts
related to the development of UCALC. It will encourage me to continue
adding new features. It will also help keep me online to support my
program.
In order to help me better support this program, please answer the
questions in QUEST.DOC, whether you decide to register or not. This
will allow me to keep the price down, and add the right features in the
next version. Use the form in REGISTER.DOC to place your registration.
Easy Service
------------
For your convenience, you can order UCALC from the Public Software
Library with your Visa, Master Card, American Express, or Discover card
by calling toll-free at 1-800-242-4PSL (overseas: 713-524-6394) or by
FAX to 713-524-6398, and even by Compuserve at 71355,470. THESE
NUMBERS ARE FOR ORDERING ONLY. I can NOT be reached at those numbers.
To registered users of UCALC v1.8
---------------------------------
Those who have registered any previous version of UCALC may get this
one for only $10.
Support
-------
I will try to extend my support to unregistered users during their
evaluation period, however, I reserve the right to limit my support for
unregistered users if their requests become taxing for me. I much
prefer to communicate by e-mail, rather than postal mail.
FREE registration for qualified students
----------------------------------------
If your school lab has a site license for the Ultimate Calculator for
use on 10 or more computers, then up to five students from your school
may receive a free registered copy of the program. All you have to do
is send me a request for your free copy, along with the name of your
school. Please check with the lab personnel first to make sure you are
one of the first five in your school to claim the free registration.
This offer is good for up to two months after your school lab has
ordered its license, and may end when the next version of UCALC is
released. If your school doesn't already have a site license, then
encourage them to get one.
License
-------
For this license agreement, a site is considered to be any corporation,
institution, government agency, computer lab, or non-personal
organization, with more than one computer capable of running the UCALC
software, and with a locally accessible tech support person or team.
This definition of a site is subject to change.
A site may use the unregistered version for evaluation purposes only.
If the site decides to continue using UCALC after 30 days, a site
license must be purchased. The site license arrangement provides for
volume discounts. See the file named REGISTER.DOC for the low rates
that are available.
A site license is for use of the software within your site, and is not
transferable. This license allows the internal use and copying of the
software by as many computers as contracted for. Distribution,
repackaging, or reselling of the licensed version to third parties is
not allowed under this agreement. The unregistered version however may
be freely distributed.
The LICENSOR (Daniel Corbier) warrants that it is the sole owner of the
UCALC software and has full power and authority to grant this license
herein without consent of any other party.
Disclaimer
----------
The Ultimate Calculator (UCALC) is provided on an "as is" basis without
warranty of any kind, expressed or implied. The person using the
software bears all risk as to the quality and performance of the
software. The author will not be held liable for any special,
incidental, consequential, direct or indirect damages due to any
malfunctions.
Aside from the legal stuff, I'm eager to support this program as much
as possible. I want to hear your suggestions for the next release.
23. Shareware Author & User Case Study
==================================
When developing UCALC, I had hoped to get many registrations, or at
least enough to support the cost of development. After releasing the
first version, I started getting an occasional registration from time
to time, each one being very helpful, but overall not enough to cover
the cost of development. I changed the registration incentive tactics
in the following version. Things did not pick up, but instead
registrations became much more sparse.
This lead me to do some research to find the right ingredients for
getting people to register. I conducted a survey asking many shareware
users what motivates them to register. I also asked a number of well-
known successful shareware authors what they have done to receive many
registrations. The results are written in a document which can be
found on many BBSes. Here's the description:
Filename: SAUCS1.ARJ (or .ZIP, .LZH, .SDN, ..)
Description: SHAREWARE AUTHOR & USER CASE STUDY v1 - Answers
questions that shareware authors often ask, such as what
motivates users to register, what prevents them from
doing so, how much they are willing to pay, how to get
one's program "out there", whether or not crippling and
nagging works, how long users take to evaluate programs
before paying, etc ... Answers are based on survey
responses from shareware users and successful authors.
Size: 42k (when compressed with ARJ)
24. My Address
==========
For information about dealer pricing, volume discounts, site licensing,
latest version, suggestions, or for technical information, you can
contact me through one of the following means:
US Mail:
Daniel Corbier
11670 NE 20th Dr
Miami, FL 33181
Internet:
corbier@delphi.com
or corbier@satelnet.org
Fidonet:
Daniel Corbier at 1:135/110 or Daniel Corbier at 1:135/23
Compuserve:
INTERNET: corbier@delphi.com
or INTERNET: corbier@satelnet.org
In the Miami area, I usually frequent the following BBSes daily:
Telcom Central 305-828-7909
MACC 305-596-1854
SOX 305-821-3317
I usually read the following conferences on a daily basis:
Fidonet: Shareware, ECPROG, Science and more
Internet: various comp.sys, and sci.math newsgroups
25. Distribution
============
You are encouraged to distribute the shareware version of the Ultimate
Calculator. The following files must all be present and unmodified
when distributed:
UCALC.DE Example for a UCALC.DEF file
UCALC.EXE Executable
UCALC.DOC Documentation
QUEST.DOC Questionnaire
HISTORY.DOC Lists the features that were added in each version
EXAMPLES.DOC Examples for Ucalc
REGISTER.DOC Registration form
PLOTDEMO Graphic demo. Type UCALC < PLOTDEMO from DOS to see it
GRAPH1.DAT Sample data file for the graphic demo
GRAPH2.DAT Another sample data file
CONVERT.DEF Conversion functions
FILE_ID.DIZ Descriptions for BBS use
The compressed file name must be UCALC24.??? or UCAL24.??? (replace ???
with ARJ, ZIP, LZH or whatever compression suffix being used).
Vendors
-------
Vendors may distribute UCALC, as long as it is not labeled "free",
"cheap", "copyright free", or "public domain". It must be made clear
to customers that this program is shareware, and that a payment must be
made to the author if they continue using it. All ASP distributors in
good standing may distribute the Ultimate Calculator without my written
permission (although I would appreciate a copy of your catalog).
Vendors who operate with good business ethics should feel free to
distribute UCALC without my written permission.
26. Acknowledgments
===============
I would like to thank those who have registered UCALC, and everyone who
has sent suggestions. I would also like to thank the following people
for being beta testers for the Ultimate Calculator:
Jonathan Borwein University of Waterloo
David G. Caraballo Princeton University
Elan Feingold Cornell University
Daryl Gungadoo Andrews University
James Hague
Rich Holland Kansas State University
Willie Hutton University of Colorado
Mark W Jacobs Stanford University
Michael D. Lawler Ball State University
Chris Long Rutgers University
Mark E. Mallett
Peter Paul Meiler TNO Physics & Electronics Lab, the Netherlands
Marty Milette Mitel Corporation
Matt Pardo North Carolina Medical Center
Alexander Pruss University of British Columbia
Glauber Ribeiro O.C. International, Brazil
Dave Sklar Temple University
John Steele Video Business Systems
David Steinman University of Toronto
Sue Widemark
Shi-Chang Wooh Northwestern University, Illinois
<<<< END OF UCALC DOCUMENTATION >>>>